<template>
	<div id="list">
		<h2>History list <button @click="clearHistory(historyList)" :disabled="!historyList.length > 0">Clear Histgor</button></h2>

		<p v-show="historyList.length">
			<ul>
				<li v-for="h in historyList">
					{{h.id}} - {{ h.title }}
				</li>
			</ul>
		</p>
		
	</div>
</template>
<script>
import { mapGetters, mapActions } from 'vuex'

export default {
	name: 'historyList',
	computed: {
		...mapGetters({
			count: 'count',
			historyList: 'allHistory'
		})
	},
	methods: {
		...mapActions(['clearHistory'])
	},
	created() {
		//this.$store.dispatch('getAllArticles', { page: 2})
	}
}
</script>